home *** CD-ROM | disk | FTP | other *** search
- // =================================================================
- // Dbcmd.cpp
- // =================================================================
- // Harold Kasperink / John Dekker
- // Dr. Dobb's Journal 1997
- // =================================================================
- // Dbase command class implementation
- // =================================================================
- #include <stdio.h>
- #include <string.h>
- #include <iostream.h>
-
- #include "dbarray.h"
-
- extern "C" long DbCmdFunc(void *pCmd, const char *pszFile, long lLine, long lSql)
- {
- CDbCommand *pTmp = (CDbCommand *)pCmd;
-
- pTmp->Location(pszFile, lLine);
- pTmp->Sql(lSql);
-
- return lSql;
- }
-
- ////////////////////////////////////////////////////////////////////
- // CDbCommand::CDbCommand
- ////////////////////////////////////////////////////////////////////
- CDbCommand::CDbCommand()
- {
- m_pDbase = 0;
- }
-
- ////////////////////////////////////////////////////////////////////
- // CDbCommand::CDbCommand
- ////////////////////////////////////////////////////////////////////
- CDbCommand::CDbCommand(CDbase &dbase)
- {
- m_pDbase = &dbase;
- }
-
- ////////////////////////////////////////////////////////////////////
- // CDbCommand::~CDbCommand
- ////////////////////////////////////////////////////////////////////
- CDbCommand::~CDbCommand()
- {
- }
-
- ////////////////////////////////////////////////////////////////////
- // CDbCommand::ThrowDbError
- ////////////////////////////////////////////////////////////////////
- void CDbCommand::ThrowDbError(boolean bUnlock)
- {
- if (bUnlock && m_pDbase)
- CArrayDbase::ReleaseDbase(*m_pDbase);
-
- // Now Throw the Error Message
- }
-
- ////////////////////////////////////////////////////////////////////
- // CDbCommand::Dbase
- ////////////////////////////////////////////////////////////////////
- CDbase *CDbCommand::Dbase()
- {
- if (m_pDbase == 0) {
- // throw error
- ;
- }
-
- return m_pDbase;
- }
-
- ////////////////////////////////////////////////////////////////////
- // CDbCommand::Dbase
- ////////////////////////////////////////////////////////////////////
- void CDbCommand::Dbase(CDbase &dbase)
- {
- m_pDbase = &dbase;
- }
-
- ////////////////////////////////////////////////////////////////////
- // CDbCommand::Location
- ////////////////////////////////////////////////////////////////////
- void CDbCommand::Location(const char *pszFile, long lLine)
- {
- m_pszFile = pszFile;
- m_lLine = lLine;
- }
-
- ////////////////////////////////////////////////////////////////////
- // CDbCommand::Sql
- ////////////////////////////////////////////////////////////////////
- void CDbCommand::Sql(long lSql)
- {
- m_lSql = lSql;
- }
-
-
-